#include<cstdio>//uncle-lu
#include<vector>
#include<algorithm>
std::vector<int>edge[101];
bool visit[101];
int n, m;
int s, t;
bool flag;

void DFS(int x)
{
	if(x == t)//x是终点
	{
		flag = true;
		return ;
	}
	for (int i = 0; i < (int)edge[x].size(); i++) //枚举x点的出边
	{
		int v = edge[x][i];//v是终点
		if(visit[v])continue;//判断是否走过 走过了，没有必要继续从v往下走

		visit[v] = true;
		DFS(v);
		//visit[v] = false;// 回溯
	}
	return ;
}
int main()
{
	scanf("%d %d", &n, &m);
	int x, y;
	for (int i = 1; i <= m; i++) 
	{
		scanf("%d %d", &x, &y);
		edge[x].push_back(y);//加边
	}
	scanf("%d %d", &s, &t);
	DFS(s);
	if(flag)
		printf("YES");
	else
		printf("NO");
	return 0;
}
